<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

class FeedbackController extends BaseController
{
    public $validate = [
        "add" => ["rules" => [
            "content" => "required|string|max:800",
            "type" => 'in:0,1,2,3'
        ]],
    ];

    /**
     * @path /feedback/add
     * @category 意见反馈
     * @title 新增
     * @method POST
     * @params [{"name":"content","type":"text","required":1,"example":"","desc":"内容"},{"name":"type","type":"text","required":1,"example":"","desc":"0普通，1智囊团，2行业，3职业"},{"name":"contact","type":"text","required":0,"example":"","desc":"联系方式"}]
     * @resBody {"success":true,"statusCode":200,"result":true,"message":"OK"}
     */
    public function add(Request $request)
    {
        $params = $request->post();
        $params['user_id'] = $this->getCurrentUserId();

        $data = service()->FeedbackService->createFeedback($this->filterSignParams($params));

        return $this->apiReturn($data);
    }
}
